from django.utils.decorators import method_decorator

from gis.common.django_ext.decorators import validate_parameters
from gis.common.django_ext.views import BaseView
from itpay.core.agency import agency_service
from . import form

H5_PAY_URI = ''


class OnlineAgencyListView(BaseView):
    @method_decorator(validate_parameters(form.ListOnlineAgency))
    def get(self, request, cleaned_data):
        return agency_service.list_online_agency(**cleaned_data)


class ComplaintAgencyView(BaseView):
    @method_decorator(validate_parameters(form.CreateComplaintSchema))
    def post(self, request, cleaned_data):
        complain = agency_service.complaint_agency(**cleaned_data)
        return dict(id=complain['id'])
